import request from "../utils/request";

//获得学生试题列表接口
export const questionListService = (uid, currentPageList,pageSizeList) => {
  return request.post("/student/test/list", { uid,currentPageList,pageSizeList });
};

//自动生成接口
export const aiCreateQuestionService = (uid, form) => {
  return request.post("/student/create/ai", {
    test: {
      tname: form.name,
      subject: form.subject,
      cnum: form.singleChoice,
      fnum: form.gapFilling,
      snum: form.freeResponse,
      kpoint: form.knowledgePoint,
    },
    user: { uid },
  });
};

//删除试题接口
export const deleteQuestionService = (tid, uid) => {
  return request.post("/student/test/delete", { tid, uid });
};

//查看试题接口
export const checkQuestionService = (tid, uid) => {
  return request.post("/student/question/all", {
    tid,
    uid,
  });
};

//提交试卷批改接口
export const correctingQuestionService = (questionList) => {
  return request.post("/student/correcting/ai", questionList);
};

//保存试卷接口
export const preserveQuestionService = (questionList) => {
  return request.post("/student/do/homework", questionList);
};

//重置试卷接口
export const resetQuestionService = (tid, uid) => {
  return request.post("/student/question/reset", {
    tid,
    uid,
  });
};

//获取数据库里面所有的这个学科的对应知识点的题目接口
export const humanQuestionService = (uid, form, type = null, content = null, kpoint = null, page = 1) => {
  return request.post("/student/human/question", {
    test: {
      tname: form.name,
      subject: form.subject,
    },
    user: { uid },
    type: type,
    content: content,
    kpoint: kpoint,
    page: page
  });
};

//人工组卷接口
export const createHumanService = (uid, form, questionMap) => {
  return request.post("/student/create/human", {
    test: {
      tid: form.tid,
      subject: form.subject,
    },
    user: { uid },
    questionMap,
  });
};

//生成单一学科做题情况分析接口
export const createAnalysisService = (sid, subject) => {
  return request.post("/student/create/analysis", { sid, subject });
};

//获取所有分析的接口
export const getAnalysisListService = (sid) => {
  return request.post("/student/analysis/list", { sid });
};

//获取指定分析的内容接口
export const getAnalysisService = (aid) => {
  return request.post("/student/get/content", { aid });
};

//删除分析的接口
export const deleteAnalysisService = (aid) => {
  return request.post("/student/delete/content", {aid });
};

//获得班级列表接口
export const getClassListService = (cid, sid, belong) => {
  return request.post("/student/list/class", { cid, sid, belong });
};

//加入班级接口
export const joinClassService = (cid, sid, belong) => {
  return request.post("/student/join/class", { cid, sid, belong });
};

//退出班级接口
export const cancelClassService = (cid, sid, belong) => {
  return request.post("/student/cancel/class", { cid, sid, belong });
};

//返回家长列表
export const getParentListService = (sid) => {
  return request.post("/student/list/parent", { sid });
};

//绑定家长
export const bindParentService = (pid,sid) => {
  return request.post("/student/bind/parent", { pid, sid });
};

//解绑家长
export const cancelParentService = (pid,sid) => {
  return request.post("/student/cancel/parent", { pid, sid });
};

//创建人工组卷的题目接口
export const createHumanQuestionService = (uid, form) => {
  return request.post("/student/create/human/test", {
    test: {
      tname: form.name,
      subject: form.subject,
    },
    user: { uid }
  });
};
